import { PartialType } from '@nestjs/swagger';
import { Decorator_DtoIsNumber_Base } from '@/common/decorators/dtoIsNumber';
import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsOptional, IsString } from 'class-validator';

export class Dynamic_Create_Dto {
  @IsString()
  @IsNotEmpty()
  @ApiProperty({ description: '标题' })
  dynamicTitle: string;

  @IsString()
  @IsNotEmpty()
  @ApiProperty({ description: '展示的发表日期' })
  dynamicTime: string;

  @IsString()
  @IsOptional()
  @ApiProperty({ description: '详情' })
  dynamicDetail?: string;

  @IsString()
  @IsNotEmpty()
  @ApiProperty({ description: '封面图' })
  dynamicCover: string;

  @IsString()
  @IsOptional()
  @ApiProperty({ description: '链接' })
  dynamicLink?: string;
}

export class Dynamic_Find_Dto {
  @Decorator_DtoIsNumber_Base()
  @IsOptional()
  size?: number;

  @Decorator_DtoIsNumber_Base()
  @IsOptional()
  page?: number;
}

export class Dynamic_Update_Dto extends PartialType(Dynamic_Create_Dto) {
  @Decorator_DtoIsNumber_Base()
  @IsNotEmpty()
  id: number;
}
